package com.example.content.fragment.search

import androidx.fragment.app.Fragment
import com.example.content.R
import com.example.content.adapter.viewpager.HomePagerAdapter
import com.example.content.databinding.FragmentSearchProductLayoutBinding
import com.example.content.databinding.SearchFragmentLayoutBinding
import com.example.content.fragment.BaseMvvmFragment
import com.example.content.viewmodule.CommonViewModel

/**
 * Created by zhudongao
 * Desc
 * Date 5/13/21
 */
class SearchFragment : BaseMvvmFragment<SearchFragmentLayoutBinding, CommonViewModel>(){

    private val titles = arrayOf("作品", "用户")
    private val fragments = mutableListOf<Fragment>()

    override fun initView() {
        fragments.add(SearchProductFragment())
        fragments.add(SearchUserFragment())
        dataBinding.viewPager.adapter = HomePagerAdapter(childFragmentManager, fragments, titles)
        dataBinding.slidingTab.setViewPager(dataBinding.viewPager, titles)
    }

    override fun getViewModuleClass(): Class<CommonViewModel> {
        return CommonViewModel::class.java
    }

    override fun getLayoutId(): Int {
        return R.layout.search_fragment_layout
    }
}